/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.yonsei.iwb.sdt.algorithm;

import com.hp.hpl.jena.rdf.model.Resource;
import java.util.Vector;
import org.yonsei.iwb.sdt.ontology.PropertyArc;

/**
 *
 * @author DK
 */
public class SearchedInstanceCache {
    private static Vector<PropertyArc> paset = new Vector();
    private static Vector<Resource> classset = new Vector();
    private static Vector<Vector<Resource>> insset = new Vector();
            
    public static void put(PropertyArc pa, Resource r, Vector<Resource> instances){
        if(!paset.contains(pa) || !classset.contains(r)){
            paset.add(pa);
            classset.add(r);
            insset.add(instances);            
        }        
    }
    
    public static Vector<Resource> get(PropertyArc pa, Resource r){        
        for (int i = 0; i < paset.size(); i++) {
            PropertyArc getp = paset.get(i);        
            if(getp.equals(pa)){
                if(classset.get(i).equals(r)){
                    return insset.get(i);
                }
            }
        }
        return new Vector();
    }
    
}
